6.2 Signals of the Muscles and Motions

|

237

%plot(time_force(1:length(ddval(11:end))), ddval(11:end), 'k:')

scatter(filt_time_force(DA), filt_force(DA), 100, 'kx') %display ...

maxima

scatter(filt_time_force(DB), filt_force(DB), 100, 'kx') %display ...

minima

xlabel('Time t/s')

ylabel('Force F/N')

axis([0 10 250 500])

title('Second Derivative Zeros in Force Data')

%thresholding algorithm

%Calculating force local minima

threshold_value = 0.95; %set beginning threshold value

while true

%threshold array calculation

threshold_force = threshold_value*abs(mean(value_force));

local_minima_force = value_force';

local_minima_force(value_force > threshold_force) = 0;

%segment seperated by 0 calculation

%find nonzero elements

force_ne0 = find(local_minima_force);

%find local minima start indices

force_ixstart = force_ne0(diff([0 force_ne0])>1);

%find local minima end indices

force_ixend = force_ne0([find(diff(force_ne0)>1) ...

length(force_ne0)]);

if length(force_ixstart) == 6

break

else

%lower threshold value by 1%

threshold_value = threshold_value - 0.01;

end

end

%Calculating angle local minima

%data preparation

time_angle = time_angle';

time_angle = time_angle(¬isnan(value_angle))';

value_angle = value_angle';

value_angle = value_angle(¬isnan(value_angle))';

%threshold array calculation

threshold_angle = 0.95*abs(mean(value_angle));